import { fetchUserFollowers } from '@/lib/api/account/profile';
import FollowList from '../_component/FollowList';

type Props = {
	params: Promise<{ sid: string }>;
};

const PER_PAGE = 20;

export default async function UserFollowersPage({ params }: Props) {
	const { sid } = await params;
	const res = await fetchUserFollowers(sid, 1, PER_PAGE);
	const data = res.data ?? { total: 0, list: [] };

	return (
		<>
			<h2 className="user-profile__subtab-title">팔로워</h2>
			<FollowList
				mode="followers"
				memberSID={sid}
				initialList={data.list}
				initialTotal={data.total}
				initialPage={1}
				perPage={PER_PAGE}
			/>
		</>
	);
}